<!DOCTYPE html>
<html>
    <head>
        <title>Image Type</title>
        <meta charset="UTF-8">   
        <style>
            html, body {
                padding: 0px;
                margin: 0px;                
            }            
            .main {
                margin: 0px;
                padding: 0px;
                position: absolute;
                top: 0px;
                bottom: 0px;
                left: 0px;
                right: 0px;
            }
        </style>     
        <script src="../../../../lib/core/ht.js"></script>   
        <script>
            function init() {
                dataModel = new ht.DataModel();
                graphView = new ht.graph.GraphView(dataModel);
                view = graphView.getView();

                view.className = 'main';
                document.body.appendChild(view);
                window.addEventListener('resize', function(e) {
                    graphView.invalidate();
                }, false);
                
                ht.Default.setImage('background', 80, 240, '');
                ht.Default.setImage('thermometer', {
                    width: 80,
                    height: 240,
                    comps: [                       
                        {
                            type: 'image',
                            name: 'background',
                            relative: true,
                            rect: [0, 0, 1, 1]
                        },
                        {
                            type: 'rect',
                            rect:  [24, 85, 15, 100],
                            background: '#E74C3C',
                            gradient: 'spread.east'
                        }
                    ]
                });               

                var node = new ht.Node();
                node.setPosition(80, 150);
                node.setImage('thermometer');
                node.s('image.stretch', 'centerUniform');
                dataModel.add(node);   

                graphView.setEditable(true);
            }


        </script>
    </head>
    <body onload="init();">
    </body>
</html>
